/*
 * @Author: your name
 * @Date: 2021-10-22 20:46:26
 * @LastEditTime: 2021-11-21 18:13:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \yunnan\src\api\connect.js
 */
import axios from "../utils/HTTP";
import { Service, Mock } from "../utils/service"; // 把请求地址模块化统一管理

export const getMockData = () => {
  return axios.get(Mock.aircity + "/test.json");
};

//  https://geoapi.qweather.com/v2/city/lookup?location=beij&key=你的KEY
// 请求接口示例
export const getApiData = () => {
  return axios.get(Service.mdoel1 + "/test");
};
// 请求获取天气id接口
export const getWeatherCityId = (name) => {
  return axios.get(
    Service.WeatherId +
      `/v2/city/lookup?location=${name}&key=c9ababc26a504434b6fc709c2005e503`
  );
};
// 请求获取天气接口
export const getWeather = (id) => {
  return axios.get(
    Service.WeatherData +
      `/v7/weather/3d?location=${id}&key=c9ababc26a504434b6fc709c2005e503`
  );
};
// 请求获取Pm2P5接口
export const getWeatherPm2P5 = (id) => {
  return axios.get(
    Service.WeatherData +
      `/v7/air/now?location=${id}&key=c9ababc26a504434b6fc709c2005e503`
  );
};

// 现状模块
// 获取林地数据
export const getLindi = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/lindi?isRegion=${param}`);
};

// 获取土地利用变更数据
export const getTdlybgtj = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/tdlybgtj?isRegion=${param}`);
};

// 获取永久基本农田数据
export const getYjjbnt = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/yjjbnt?isRegion=${param}`);
}
// 获取稳定利用耕地数据
export const getWdlygd = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/wdlygd?isRegion=${param}`);
}
// 获取一级水源保护区数据--
export const getYjsy = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/yjshybhq?isRegion=${param}`);
}
// 获取土地出让数据
export const getTdcr = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/tdgy?isRegion=${param}`);
}
// 获取建筑数据
export const getJz = (param) =>{
  return axios.get(Service.Sjsx + `/overlay/analysis/jzwpch?isRegion=${param}`);
}

// 获取村落数据
export const getCunluo = (param) =>{
  return axios.get(Service.Sjsx + `/overlay/analysis/cunluo?isRegion=${param}`);
}

// 获取土地收储情况的数据
export const getTdsc = (param) =>{
  return axios.get(Service.Sjsx + `/overlay/analysis/tdshchqk?isRegion=${param}`);
}

// 获取河道三期情况的数据
export const getHdsq = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/hdsqkj?isRegion=${param}`)
}




// 规划模块
// 获取国土空间规划三区三线的数据(规划)
export const getGtkjgh = (param) =>{
  return axios.get(Service.Sjsx + `/overlay/analysis/gtkjgh?isRegion=${param}`)
}

// 获取土地利用总体规划关系一栏表-a
export const getZtghA = (param) =>{
  return axios.get(Service.Sjsx + `/overlay/analysis/tdlyztghgx_a?isRegion=${param}`)
}
// 获取土地利用总体规划关系一栏表-b
export const getZtghB = (param) =>{
  return axios.get(Service.Sjsx + `/overlay/analysis/tdlyztghgx_b?isRegion=${param}`)
}



// 上传shp
export const getshpupload = () => {
  return axios.post(Service.Sjsx + `/overlay/analysis/upload/shp`);
};
// 新增自定义面
export const getAddCustomPolygon = (params) => {
  return axios.post(Service.Sjsx + `/overlay/analysis/addCustomPolygon`,params);
}
// 获取上传shp的面积信息
export const getshparea = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/region/area?isRegion=${param}`);
};
// 获取上传shp后数据的解析
export const getRegion = (param) => {
  return axios.get(Service.Sjsx + `/overlay/analysis/region?isRegion=${param}`);
};

// 项目选址获取图层的数据
export const getXzRegion = (param,params) => {
  return axios.post(Service.Sjsx + `/overlay/analysis/intersectionGeomJson?isRegion=${param}`,params);
};




// 获取现状图层树的数据
// --- 永久基本农田 ---
export const getXzYjjbnt = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A永久基本农田&maxFeatures=50000&outputFormat=application%2Fjson');
}
// --- 一级水源保护 ---
export const getXzYjsy = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A一级水源保护区&maxFeatures=50000&outputFormat=application%2Fjson');
}

// --- 稳定利用耕地 ---
export const getXzWdlygd = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A稳定利用耕地&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 土地利用变更调查(2018)
export const getXzTdlybg = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A土地利用变更调查（2018）&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 合作区已供应数据20220117 ---
export const getXzHzqygy = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A合作区已供应数据20220117&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 鹅埠镇控规未出让空地20220221 ---
export const getXzEfzkg = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A鹅埠镇控规未出让空地20220221&maxFeatures=50000&outputFormat=application%2Fjson')
}

// 获取规划图层树的数据
// --- 控制性详细规划 ---
export const getGhKzx = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A控制性详细规划&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 永久基本农田规划
export const getGhYjjbnt = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A永久基本农田规划&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 海洋生态保护红线 ---
export const getGhHyst = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A海洋生态保护红线&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 陆域生态保护红线 ---
export const getGhLyst = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A陆域生态保护红线&maxFeatures=50000&outputFormat=application%2Fjson')
}

// --- 用地推送 ---
export const getYdts = () => {
  return axios.get(Service.Geojson+'/geoserver/shenshan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shenshan%3A用地推送&maxFeatures=50000&outputFormat=application%2Fjson')
}

